﻿package com.tvein.sanguo.swc.room
{
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	
	public class RoomButton extends MovieClip
	{
		public var buttonCMD:String;
		private var buttonType:int;
		
		public function RoomButton(Name:String, Type:int, CMD:String, isVisible:Boolean)
		{
			buttonCMD = CMD;
			buttonType = Type;
			
			txtName.selectable = false;
			txtName.mouseEnabled = false;
			
			btnNormal.visible = false;
			btnOne.visible = false;
			btnTwo.visible = false;
			btnThree.visible = false;
			btnFour.visible = false;
			
			txtName.text = Name;
			
			switch (buttonType)
			{
				case 0:
					btnNormal.visible = isVisible;
					break;
				case 1:
					btnOne.visible = isVisible;
					break;
				case 2:
					btnTwo.visible = isVisible;
					break;
				case 3:
					btnThree.visible = isVisible;
					break;
				case 4:
					btnFour.visible = isVisible;
					break;
				case 5:
					btnOne.visible = isVisible;
					break;
				case 6:
					btnTwo.visible = isVisible;
					break;
				case 7:
					btnThree.visible = isVisible;
					break;
				case 8:
					btnFour.visible = isVisible;
					break;
				case 9:
					btnNormal.visible = isVisible;
					break;
			}
		}
		
		public function Visible(Value:Boolean)
		{
			switch (buttonType)
			{
				case 0:
					btnNormal.visible = Value;
					break;
				case 1:
					btnOne.visible = Value;
					break;
				case 2:
					btnTwo.visible = Value;
					break;
				case 3:
					btnThree.visible = Value;
					break;
				case 4:
					btnFour.visible = Value;
					break;
				case 5:
					btnOne.visible = Value;
					break;
				case 6:
					btnTwo.visible = Value;
					break;
				case 7:
					btnThree.visible = Value;
					break;
				case 8:
					btnFour.visible = Value;
					break;
				case 9:
					btnNormal.visible = Value;
					break;
			}
		}
	}
}
